GXGetShapeLength
You can use theGXGetShapeLength
function to determine the length of a particular contour or of all contours of a shape.
gxWide *GXGetShapeLength(gxShape source, long index, gxWide *length);
source
- A reference to the shape containing the contour.
index
- The index of the contour you want to measure. You may specify a value of 0 for this parameter to measure all contours.
length
- A pointer to a
gxWide
value. On return, this value indicates the length of the indicated contour.- function result
- The length of the indicated contour.
DESCRIPTION
TheGXGetShapeLength
function returns as the function result the length of the perimeter of a particular contour of a shape. This function calculates the length of the contour as defined in the shape's geometry; it does not consider transformations to the shape made by the shape's transform.For empty and full shapes, this function posts the warning
shape_does_not_have_length
. For point shapes, it returns zero. For solid polygon and path shapes, this function calculates the length as if the shape had the closed-frame shape fill.If you provide a target shape that is not one of the geometric shape types, this function performs the actions described in the following table:
Shape type Action taken bitmap Posts the warning shape_does_not_have_length
picture Returns the length of the specified picture item or the sum of the length of all picture items text Posts the warning shape_does_not_have_length
glyph Posts the warning shape_does_not_have_length
layout Posts the warning shape_does_not_have_length
ERRORS, WARNINGS, AND NOTICES
Errors out_of_memory shape_is_nil parameter_is_nil (debugging version) contour_is_less_than_zero (debugging version) Warnings contour_out_of_range shape_does_not_have_length (debugging version) unable_to_traverse_open_contour_that_starts_or_ends_off_the_curve (debugging version) SEE ALSO
For an example using this function, see "Finding the Length of a Contour" beginning on page 4-42.For information about the contours of the various geometric shapes, see Chapter 2, "Geometric Shapes," in this book.
Main | Page One | What's New | Apple Computer, Inc. | Find It | Contact Us | Help